Fix bug #7699 with pasting selected text on MS-Windows.
authorEli Zaretskii <eliz@gnu.org>
Sat, 25 Dec 2010 10:57:02 +0000 (12:57 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 25 Dec 2010 10:57:02 +0000 (12:57 +0200)
 mouse.el (mouse-yank-primary): On MS-Windows, try the (emulated)
 PRIMARY first, then the clipboard.

lisp/ChangeLog
lisp/mouse.el

index 9afea12dde05d8ed0b3be0855211f4d44598e77d..95669e0fa674851dc8508ec35a81ec2ca1ccee21 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-25  Eli Zaretskii  <eliz@gnu.org>
+
+       * mouse.el (mouse-yank-primary): On MS-Windows, try the (emulated)
+       PRIMARY first, then the clipboard.  (Bug#7699)
+
 2010-12-22  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * emacs-lisp/bytecomp.el (byte-compile-output-docform): Fix up use of
index aa5dadf84ff170cb1b61c59f76fa0000922b515b..14d981f78b2c0750b6cc4781358fcfb54cd9f476 100644 (file)
@@ -1282,7 +1282,16 @@ regardless of where you click."
   (or mouse-yank-at-point (mouse-set-point click))
   (let ((primary
         (cond
-         ((fboundp 'x-get-selection-value) ; MS-DOS, MS-Windows and X.
+         ((eq system-type 'windows-nt)
+          ;; MS-Windows emulates PRIMARY in x-get-selection, but not
+          ;; in x-get-selection-value (the latter only accesses the
+          ;; clipboard).  So try PRIMARY first, in case they selected
+          ;; something with the mouse in the current Emacs session.
+          (or (x-get-selection 'PRIMARY)
+              (x-get-selection-value)))
+         ((fboundp 'x-get-selection-value) ; MS-DOS and X.
+          ;; On X, x-get-selection-value supports more formats and
+          ;; encodings, so use it in preference to x-get-selection.
           (or (x-get-selection-value)
               (x-get-selection 'PRIMARY)))
          ;; FIXME: What about xterm-mouse-mode etc.?